//
//  NewsRemindTVCell.m
//  XJMCustomer
//
//  Created by Mr.hu on 2017/10/10.
//  Copyright © 2017年 Mr.hu. All rights reserved.
//

#import "NewsRemindTVCell.h"

@implementation NewsRemindTVCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.weiimageviewI = [[UIImageView alloc]init];
        [self.contentView addSubview:self.weiimageviewI];
        
        self.weititle = [[UILabel alloc]init];
        self.weititle.numberOfLines = 0;
        self.weititle.font = [UIFont systemFontOfSize:16];
        self.weititle.textColor = RGBA(89, 88, 87, 1);
        [self.contentView addSubview:self.weititle];
        
        self.weipresentprice = [[UILabel alloc]init];
        self.weipresentprice.font = [UIFont systemFontOfSize:12];
        
        self.weipresentprice.textColor = RGBA(153, 153, 153, 1);
        [self.contentView addSubview:self.weipresentprice];
        self.weiImaginaryline = [[UILabel alloc]init];
        self.weiImaginaryline.backgroundColor = TableViewCellFootColor;
        [self.contentView addSubview:self.weiImaginaryline];
        
    }
    
    return self;
}

-(void)setNewsRemindModel:(NewsRemindTVModel *)NewsRemindModel{
    
    NewsRemindModel = NewsRemindModel;
    //0未读
    if ([NewsRemindModel.todaygoodsID isEqualToString:@"0"]) {
        [self.weiimageviewI setImage:[UIImage imageNamed:@"xiaoxi1"]];
    }else{
        [self.weiimageviewI setImage:[UIImage imageNamed:@"xiaoxi2"]];
    }
    
    self.weititle.text = NewsRemindModel.todayTitle;
    self.weipresentprice.text = NewsRemindModel.todayPrice;
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat IconX = 12;
    CGFloat IconY = 20;
    CGFloat IconW = 39;
    CGFloat IconH = 30;
    //53 69
    self.weiimageviewI.frame = CGRectMake(IconX, IconY, IconW, IconH);
    
        NSDictionary * namedict = @{NSFontAttributeName:[UIFont systemFontOfSize:18]};
        CGRect nameSize = [self.weititle.text boundingRectWithSize:CGSizeMake(ScreenWidth-IconW-IconW/2, 18) options:NSStringDrawingUsesLineFragmentOrigin attributes:namedict context:nil];
        nameSize.origin.x = CGRectGetMaxX(self.weiimageviewI.frame)+10;
        nameSize.origin.y = 20;
        
        self.weititle.frame = nameSize;
        
        self.weipresentprice.frame = CGRectMake(IconX+IconW+10, 40, ScreenWidth-IconW-IconW, 15);
    
        self.weiImaginaryline.frame = CGRectMake(0, 69.5, ScreenWidth, 0.3);
    
}


@end
